import { Entity, JoinColumn, ManyToOne } from 'typeorm';
import { BaseEntity } from './BaseEntity';
import { SysDepartment } from './SysDepartment';
import { SysUser } from './SysUser';

@Entity()
export class SysDepartmentUser extends BaseEntity {
  @ManyToOne(() => SysUser, r => r.SysDepartmentUser, {
    onDelete: 'CASCADE',
    createForeignKeyConstraints: false
  })
  @JoinColumn({
    name: 'sys_user_id'
  })
  SysUserId: string;

  @ManyToOne(() => SysDepartment, d => d.SysDepartmentUser, {
    onDelete: 'CASCADE',
    createForeignKeyConstraints: false
  })
  @JoinColumn({
    name: 'sys_department_id'
  })
  SysDepartmentId: string;
}
